#ifndef WIDGETAVATARVIEW_H
#define WIDGETAVATARVIEW_H

#include <QWidget>
#include <QBasicTimer>

class WidgetAvatarView : public QWidget
{
    Q_OBJECT

public:
    explicit WidgetAvatarView(QWidget *parent = nullptr);
    ~WidgetAvatarView();
    virtual QPaintEngine* paintEngine() const override { return NULL; }

    /**
     * @brief 启动引擎
     * @param directory
     */
    void Start(const QString& directory);

    /**
     * @brief 获取屏幕大小
     * @return
     */
    QSize ScreenSize();

protected:
    void timerEvent(QTimerEvent* event) override;
    void paintEvent(QPaintEvent* event) override;
    void resizeEvent(QResizeEvent* event) override;

    void mousePressEvent(QMouseEvent *event) override;
    void mouseReleaseEvent(QMouseEvent *event) override;
    void mouseMoveEvent(QMouseEvent *event) override;
    void wheelEvent(QWheelEvent *event) override;
    void keyPressEvent(QKeyEvent *event) override;
    void keyReleaseEvent(QKeyEvent *event) override;
    void inputMethodEvent(QInputMethodEvent* event) override;
    void focusOutEvent(QFocusEvent *event) override;

private:
    QBasicTimer _timer;
    bool _keyPressedU;
    bool _keyPressedD;
    bool _keyPressedL;
    bool _keyPressedR;
};

#endif // WIDGETAVATARVIEW_H
